package com.hzhr.iot.device.convertor;

import com.hzhr.iot.device.convertor.custom.*;
import com.hzhr.iot.core.util.HzhrTypeUtil;
import com.hzhr.iot.core.util.HzhrJsonUtil;
import java.util.Map;
import com.hzhr.iot.device.model.collectData.CollectDataModel;
import com.hzhr.iot.device.model.collectData.CollectDataPostModel;
import com.hzhr.iot.device.entity.CollectDataEntity;
import com.hzhr.iot.device.entity.ext.CollectDataEntityExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.hzhr.iot.device.model.collectData.CollectDataModel;
import com.hzhr.iot.device.model.collectData.CollectDataGetModel;
import com.hzhr.iot.device.model.collectData.CollectDataPostModel;
import com.hzhr.iot.device.model.concentrator_meter_collectData.Concentrator_Meter_CollectDataModel;
import com.hzhr.iot.device.model.concentrator_meter_collectData.Concentrator_Meter_CollectDataGetModel;
import com.hzhr.iot.device.queryModel.custom.CollectDataCustomQueryModel;

@Component
public class CollectDataConvertor {
    @Autowired
    AlarmDataCustomConvertor alarmDataCustomConvertor;
    @Autowired
    CollectDeviceCustomConvertor collectDeviceCustomConvertor;
    @Autowired
    CollectDeviceTypeCustomConvertor collectDeviceTypeCustomConvertor;
    @Autowired
    DeviceInfoCardCustomConvertor deviceInfoCardCustomConvertor;
    @Autowired
    DeviceMaintenanceCardCustomConvertor deviceMaintenanceCardCustomConvertor;
    @Autowired
    DeviceMaintenanceCardItemCustomConvertor deviceMaintenanceCardItemCustomConvertor;
    @Autowired
    ImplFactoryCustomConvertor implFactoryCustomConvertor;
    @Autowired
    ImplIotDeviceTypeCustomConvertor implIotDeviceTypeCustomConvertor;
    @Autowired
    ImplRecordCustomConvertor implRecordCustomConvertor;
    @Autowired
    IotDeviceCustomConvertor iotDeviceCustomConvertor;
    @Autowired
    IotDeviceTypeCustomConvertor iotDeviceTypeCustomConvertor;
    @Autowired
    OptionsCustomConvertor optionsCustomConvertor;
    @Autowired
    ProdFactoryCustomConvertor prodFactoryCustomConvertor;
    @Autowired
    RegulatorCollectDataCustomConvertor regulatorCollectDataCustomConvertor;
    @Autowired
    UserCompanyCustomConvertor userCompanyCustomConvertor;

    public CollectDataEntity collectDataModel2entity(CollectDataModel in) {
        //未转换字段: createTime extProp isValid updateTime state 
        if (in == null) return null;
        CollectDataEntity result = new CollectDataEntity();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setCollectDeviceId(HzhrTypeUtil.integer2integer(in.getCollectDeviceId()));
        result.setIotDeviceId(HzhrTypeUtil.integer2integer(in.getIotDeviceId()));
        result.setCurrentTm(HzhrTypeUtil.long2date(in.getCurrentTm()));
        result.setCurrentValue(HzhrTypeUtil.double2double(in.getCurrentValue()));
        result.setFreezingTime(HzhrTypeUtil.long2date(in.getFreezingTime()));
        result.setFreezingValue(HzhrTypeUtil.double2double(in.getFreezingValue()));
        result.setStaTotalFlow(HzhrTypeUtil.double2double(in.getStaTotalFlow()));
        result.setWorkTotalFlow(HzhrTypeUtil.double2double(in.getWorkTotalFlow()));
        result.setDisTotalFlow(HzhrTypeUtil.double2double(in.getDisTotalFlow()));
        result.setStaFlowRate(HzhrTypeUtil.double2double(in.getStaFlowRate()));
        result.setWorkFlowRate(HzhrTypeUtil.double2double(in.getWorkFlowRate()));
        result.setPressure(HzhrTypeUtil.double2double(in.getPressure()));
        result.setTemperature(HzhrTypeUtil.float2float(in.getTemperature()));
        result.setValveStatusCode(HzhrTypeUtil.string2string(in.getValveStatusCode()));
        result.setSignalStrength(HzhrTypeUtil.integer2integer(in.getSignalStrength()));
        result.setCellVoltage(HzhrTypeUtil.float2float(in.getCellVoltage()));
        result.setCellId(HzhrTypeUtil.string2long(in.getCellId()));
        result.setAlarmCodes(HzhrTypeUtil.string2string(in.getAlarmCodes()));
        return result;
    }
    public CollectDataEntity collectDataModel2entity(CollectDataModel in, CollectDataEntity ori) {
        //未转换字段: createTime extProp isValid updateTime state 
        if (in == null) return null;
        CollectDataEntity result = ori;

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setCollectDeviceId(HzhrTypeUtil.integer2integer(in.getCollectDeviceId()));
        result.setIotDeviceId(HzhrTypeUtil.integer2integer(in.getIotDeviceId()));
        result.setCurrentTm(HzhrTypeUtil.long2date(in.getCurrentTm()));
        result.setCurrentValue(HzhrTypeUtil.double2double(in.getCurrentValue()));
        result.setFreezingTime(HzhrTypeUtil.long2date(in.getFreezingTime()));
        result.setFreezingValue(HzhrTypeUtil.double2double(in.getFreezingValue()));
        result.setStaTotalFlow(HzhrTypeUtil.double2double(in.getStaTotalFlow()));
        result.setWorkTotalFlow(HzhrTypeUtil.double2double(in.getWorkTotalFlow()));
        result.setDisTotalFlow(HzhrTypeUtil.double2double(in.getDisTotalFlow()));
        result.setStaFlowRate(HzhrTypeUtil.double2double(in.getStaFlowRate()));
        result.setWorkFlowRate(HzhrTypeUtil.double2double(in.getWorkFlowRate()));
        result.setPressure(HzhrTypeUtil.double2double(in.getPressure()));
        result.setTemperature(HzhrTypeUtil.float2float(in.getTemperature()));
        result.setValveStatusCode(HzhrTypeUtil.string2string(in.getValveStatusCode()));
        result.setSignalStrength(HzhrTypeUtil.integer2integer(in.getSignalStrength()));
        result.setCellVoltage(HzhrTypeUtil.float2float(in.getCellVoltage()));
        result.setCellId(HzhrTypeUtil.string2long(in.getCellId()));
        result.setAlarmCodes(HzhrTypeUtil.string2string(in.getAlarmCodes()));
        return result;
    }
    public List<CollectDataEntity> collectDataModelList2entityList(List<CollectDataModel> in) {
        if (in == null) return null;
        List<CollectDataEntity> result = new ArrayList<>();
        for (CollectDataModel item : in) {
            result.add(collectDataModel2entity(item));
        }
        return result;
    }
    public CollectDataModel entity2collectDataModel(CollectDataEntity in) {
        //未转换字段: rssi valveStatusDes rsrq snr pci collectDeviceCode earfcn ecl 
        if (in == null) return null;
        CollectDataModel result = new CollectDataModel();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setCollectDeviceId(HzhrTypeUtil.integer2integer(in.getCollectDeviceId()));
        result.setIotDeviceId(HzhrTypeUtil.integer2integer(in.getIotDeviceId()));
        result.setCurrentTm(HzhrTypeUtil.date2long(in.getCurrentTm()));
        result.setCurrentValue(HzhrTypeUtil.double2double(in.getCurrentValue()));
        result.setFreezingTime(HzhrTypeUtil.date2long(in.getFreezingTime()));
        result.setFreezingValue(HzhrTypeUtil.double2double(in.getFreezingValue()));
        result.setStaTotalFlow(HzhrTypeUtil.double2double(in.getStaTotalFlow()));
        result.setWorkTotalFlow(HzhrTypeUtil.double2double(in.getWorkTotalFlow()));
        result.setDisTotalFlow(HzhrTypeUtil.double2double(in.getDisTotalFlow()));
        result.setStaFlowRate(HzhrTypeUtil.double2double(in.getStaFlowRate()));
        result.setWorkFlowRate(HzhrTypeUtil.double2double(in.getWorkFlowRate()));
        result.setPressure(HzhrTypeUtil.double2double(in.getPressure()));
        result.setTemperature(HzhrTypeUtil.float2float(in.getTemperature()));
        result.setValveStatusCode(HzhrTypeUtil.string2string(in.getValveStatusCode()));
        result.setSignalStrength(HzhrTypeUtil.integer2integer(in.getSignalStrength()));
        result.setCellVoltage(HzhrTypeUtil.float2float(in.getCellVoltage()));
        result.setCellId(HzhrTypeUtil.object2string(in.getCellId()));
        result.setAlarmCodes(HzhrTypeUtil.string2string(in.getAlarmCodes()));
        return result;
    }
    public List<CollectDataModel> entityList2collectDataModelList(List<CollectDataEntity> in) {
        if (in == null) return null;
        List<CollectDataModel> result = new ArrayList<>();
        for (CollectDataEntity item : in) {
            result.add(entity2collectDataModel(item));
        }
        return result;
    }
    public CollectDataModel ext2collectDataModel(CollectDataEntityExt in) {
        //未转换字段: rssi valveStatusDes rsrq snr pci collectDeviceCode earfcn ecl 
        if (in == null) return null;
        CollectDataModel result = new CollectDataModel();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setCollectDeviceId(HzhrTypeUtil.integer2integer(in.getCollectDeviceId()));
        result.setIotDeviceId(HzhrTypeUtil.integer2integer(in.getIotDeviceId()));
        result.setCurrentTm(HzhrTypeUtil.date2long(in.getCurrentTm()));
        result.setCurrentValue(HzhrTypeUtil.double2double(in.getCurrentValue()));
        result.setFreezingTime(HzhrTypeUtil.date2long(in.getFreezingTime()));
        result.setFreezingValue(HzhrTypeUtil.double2double(in.getFreezingValue()));
        result.setStaTotalFlow(HzhrTypeUtil.double2double(in.getStaTotalFlow()));
        result.setWorkTotalFlow(HzhrTypeUtil.double2double(in.getWorkTotalFlow()));
        result.setDisTotalFlow(HzhrTypeUtil.double2double(in.getDisTotalFlow()));
        result.setStaFlowRate(HzhrTypeUtil.double2double(in.getStaFlowRate()));
        result.setWorkFlowRate(HzhrTypeUtil.double2double(in.getWorkFlowRate()));
        result.setPressure(HzhrTypeUtil.double2double(in.getPressure()));
        result.setTemperature(HzhrTypeUtil.float2float(in.getTemperature()));
        result.setValveStatusCode(HzhrTypeUtil.string2string(in.getValveStatusCode()));
        result.setSignalStrength(HzhrTypeUtil.integer2integer(in.getSignalStrength()));
        result.setCellVoltage(HzhrTypeUtil.float2float(in.getCellVoltage()));
        result.setCellId(HzhrTypeUtil.object2string(in.getCellId()));
        result.setAlarmCodes(HzhrTypeUtil.string2string(in.getAlarmCodes()));
        return result;
    }
    public List<CollectDataModel> extList2collectDataModelList(List<CollectDataEntityExt> in) {
        if (in == null) return null;
        List<CollectDataModel> result = new ArrayList<>();
        for (CollectDataEntityExt item : in) {
            result.add(ext2collectDataModel(item));
        }
        return result;
    }
    public CollectDataGetModel extList2collectDataGetModel(List<CollectDataEntityExt> extList, Integer total, Integer changeCount, Map<String, Object> query) {
        List<CollectDataModel> modelList = extList2collectDataModelList(extList);
        if (modelList == null) {
            CollectDataGetModel result = new CollectDataGetModel();
            result.setTotal(total);
            result.setChangeCount(changeCount);
            return result;
        }

         String _show = HzhrTypeUtil.object2string(query.get("_show"));
         Boolean _show_info = query.get("_show_info") != null ? Boolean.parseBoolean(query.get("_show_info").toString()) : false;
         Boolean _show_ext = query.get("_show_ext") != null ? Boolean.parseBoolean(query.get("_show_ext").toString()) : false;
         Boolean _show_collectDevice = query.get("_show_collectDevice") != null ? Boolean.parseBoolean(query.get("_show_collectDevice").toString()) : false;

        if (!_show_info) {
            for (CollectDataModel model : modelList) {
                model.setCollectDeviceId(null);
                model.setIotDeviceId(null);
                model.setCurrentTm(null);
                model.setCurrentValue(null);
                model.setFreezingTime(null);
                model.setFreezingValue(null);
                model.setStaTotalFlow(null);
                model.setWorkTotalFlow(null);
                model.setDisTotalFlow(null);
                model.setStaFlowRate(null);
                model.setWorkFlowRate(null);
                model.setPressure(null);
                model.setTemperature(null);
                model.setValveStatusCode(null);
                model.setValveStatusDes(null);
                model.setSignalStrength(null);
                model.setCellVoltage(null);
                model.setCellId(null);
                model.setAlarmCodes(null);
            }
        }
        if (!_show_ext) {
            for (CollectDataModel model : modelList) {
                model.setEcl(null);
                model.setRsrq(null);
                model.setRssi(null);
                model.setSnr(null);
                model.setPci(null);
                model.setEarfcn(null);
            }
        }
        if (!_show_collectDevice) {
            for (CollectDataModel model : modelList) {
                model.setCollectDeviceCode(null);
            }
        }

        CollectDataGetModel result = new CollectDataGetModel();
        if ("one".equals(_show)) {
            if (modelList.size() > 0) {
                result.setModel(modelList.get(0));
            }
         }
        if ("list".equals(_show)) {
            result.setModelList(modelList);
        }
        result.setTotal(total);
        result.setChangeCount(changeCount);
        return result;
    }
    public CollectDataGetModel entity2collectDataGetModel(CollectDataEntity entity, Integer total, Integer changeCount, Map<String, Object> query) {
        List<CollectDataEntityExt> extList = new ArrayList<>();
        if (entity == null) return extList2collectDataGetModel(extList, total, changeCount, query);
        extList.add(HzhrJsonUtil.convertObjectType(entity, CollectDataEntityExt.class));
        return extList2collectDataGetModel(extList, total, changeCount, query);
     }
    public CollectDataEntity collectDataPostModel2entity(CollectDataPostModel in) {
        //未转换字段: createTime extProp isValid updateTime id state 
        if (in == null) return null;
        CollectDataEntity result = new CollectDataEntity();

        result.setCollectDeviceId(HzhrTypeUtil.integer2integer(in.getCollectDeviceId()));
        result.setIotDeviceId(HzhrTypeUtil.integer2integer(in.getIotDeviceId()));
        result.setCurrentTm(HzhrTypeUtil.long2date(in.getCurrentTm()));
        result.setCurrentValue(HzhrTypeUtil.double2double(in.getCurrentValue()));
        result.setFreezingTime(HzhrTypeUtil.long2date(in.getFreezingTime()));
        result.setFreezingValue(HzhrTypeUtil.double2double(in.getFreezingValue()));
        result.setStaTotalFlow(HzhrTypeUtil.double2double(in.getStaTotalFlow()));
        result.setWorkTotalFlow(HzhrTypeUtil.double2double(in.getWorkTotalFlow()));
        result.setDisTotalFlow(HzhrTypeUtil.double2double(in.getDisTotalFlow()));
        result.setStaFlowRate(HzhrTypeUtil.double2double(in.getStaFlowRate()));
        result.setWorkFlowRate(HzhrTypeUtil.double2double(in.getWorkFlowRate()));
        result.setPressure(HzhrTypeUtil.double2double(in.getPressure()));
        result.setTemperature(HzhrTypeUtil.float2float(in.getTemperature()));
        result.setValveStatusCode(HzhrTypeUtil.string2string(in.getValveStatusCode()));
        result.setSignalStrength(HzhrTypeUtil.integer2integer(in.getSignalStrength()));
        result.setCellVoltage(HzhrTypeUtil.float2float(in.getCellVoltage()));
        result.setCellId(HzhrTypeUtil.string2long(in.getCellId()));
        result.setAlarmCodes(HzhrTypeUtil.string2string(in.getAlarmCodes()));
        return result;
    }
    public CollectDataEntity collectDataPostModel2entity(CollectDataPostModel in, CollectDataEntity ori) {
        //未转换字段: createTime extProp isValid updateTime id state 
        if (in == null) return null;
        CollectDataEntity result = ori;

        result.setCollectDeviceId(HzhrTypeUtil.integer2integer(in.getCollectDeviceId()));
        result.setIotDeviceId(HzhrTypeUtil.integer2integer(in.getIotDeviceId()));
        result.setCurrentTm(HzhrTypeUtil.long2date(in.getCurrentTm()));
        result.setCurrentValue(HzhrTypeUtil.double2double(in.getCurrentValue()));
        result.setFreezingTime(HzhrTypeUtil.long2date(in.getFreezingTime()));
        result.setFreezingValue(HzhrTypeUtil.double2double(in.getFreezingValue()));
        result.setStaTotalFlow(HzhrTypeUtil.double2double(in.getStaTotalFlow()));
        result.setWorkTotalFlow(HzhrTypeUtil.double2double(in.getWorkTotalFlow()));
        result.setDisTotalFlow(HzhrTypeUtil.double2double(in.getDisTotalFlow()));
        result.setStaFlowRate(HzhrTypeUtil.double2double(in.getStaFlowRate()));
        result.setWorkFlowRate(HzhrTypeUtil.double2double(in.getWorkFlowRate()));
        result.setPressure(HzhrTypeUtil.double2double(in.getPressure()));
        result.setTemperature(HzhrTypeUtil.float2float(in.getTemperature()));
        result.setValveStatusCode(HzhrTypeUtil.string2string(in.getValveStatusCode()));
        result.setSignalStrength(HzhrTypeUtil.integer2integer(in.getSignalStrength()));
        result.setCellVoltage(HzhrTypeUtil.float2float(in.getCellVoltage()));
        result.setCellId(HzhrTypeUtil.string2long(in.getCellId()));
        result.setAlarmCodes(HzhrTypeUtil.string2string(in.getAlarmCodes()));
        return result;
    }
    public List<CollectDataEntity> collectDataPostModelList2entityList(List<CollectDataPostModel> in) {
        if (in == null) return null;
        List<CollectDataEntity> result = new ArrayList<>();
        for (CollectDataPostModel item : in) {
            result.add(collectDataPostModel2entity(item));
        }
        return result;
    }
    public CollectDataPostModel entity2collectDataPostModel(CollectDataEntity in) {
        //未转换字段: rssi rsrq snr pci earfcn ecl 
        if (in == null) return null;
        CollectDataPostModel result = new CollectDataPostModel();

        result.setCollectDeviceId(HzhrTypeUtil.integer2integer(in.getCollectDeviceId()));
        result.setIotDeviceId(HzhrTypeUtil.integer2integer(in.getIotDeviceId()));
        result.setCurrentTm(HzhrTypeUtil.date2long(in.getCurrentTm()));
        result.setCurrentValue(HzhrTypeUtil.double2double(in.getCurrentValue()));
        result.setFreezingTime(HzhrTypeUtil.date2long(in.getFreezingTime()));
        result.setFreezingValue(HzhrTypeUtil.double2double(in.getFreezingValue()));
        result.setStaTotalFlow(HzhrTypeUtil.double2double(in.getStaTotalFlow()));
        result.setWorkTotalFlow(HzhrTypeUtil.double2double(in.getWorkTotalFlow()));
        result.setDisTotalFlow(HzhrTypeUtil.double2double(in.getDisTotalFlow()));
        result.setStaFlowRate(HzhrTypeUtil.double2double(in.getStaFlowRate()));
        result.setWorkFlowRate(HzhrTypeUtil.double2double(in.getWorkFlowRate()));
        result.setPressure(HzhrTypeUtil.double2double(in.getPressure()));
        result.setTemperature(HzhrTypeUtil.float2float(in.getTemperature()));
        result.setValveStatusCode(HzhrTypeUtil.string2string(in.getValveStatusCode()));
        result.setSignalStrength(HzhrTypeUtil.integer2integer(in.getSignalStrength()));
        result.setCellVoltage(HzhrTypeUtil.float2float(in.getCellVoltage()));
        result.setCellId(HzhrTypeUtil.object2string(in.getCellId()));
        result.setAlarmCodes(HzhrTypeUtil.string2string(in.getAlarmCodes()));
        return result;
    }
    public List<CollectDataPostModel> entityList2collectDataPostModelList(List<CollectDataEntity> in) {
        if (in == null) return null;
        List<CollectDataPostModel> result = new ArrayList<>();
        for (CollectDataEntity item : in) {
            result.add(entity2collectDataPostModel(item));
        }
        return result;
    }
    public CollectDataPostModel ext2collectDataPostModel(CollectDataEntityExt in) {
        //未转换字段: rssi rsrq snr pci earfcn ecl 
        if (in == null) return null;
        CollectDataPostModel result = new CollectDataPostModel();

        result.setCollectDeviceId(HzhrTypeUtil.integer2integer(in.getCollectDeviceId()));
        result.setIotDeviceId(HzhrTypeUtil.integer2integer(in.getIotDeviceId()));
        result.setCurrentTm(HzhrTypeUtil.date2long(in.getCurrentTm()));
        result.setCurrentValue(HzhrTypeUtil.double2double(in.getCurrentValue()));
        result.setFreezingTime(HzhrTypeUtil.date2long(in.getFreezingTime()));
        result.setFreezingValue(HzhrTypeUtil.double2double(in.getFreezingValue()));
        result.setStaTotalFlow(HzhrTypeUtil.double2double(in.getStaTotalFlow()));
        result.setWorkTotalFlow(HzhrTypeUtil.double2double(in.getWorkTotalFlow()));
        result.setDisTotalFlow(HzhrTypeUtil.double2double(in.getDisTotalFlow()));
        result.setStaFlowRate(HzhrTypeUtil.double2double(in.getStaFlowRate()));
        result.setWorkFlowRate(HzhrTypeUtil.double2double(in.getWorkFlowRate()));
        result.setPressure(HzhrTypeUtil.double2double(in.getPressure()));
        result.setTemperature(HzhrTypeUtil.float2float(in.getTemperature()));
        result.setValveStatusCode(HzhrTypeUtil.string2string(in.getValveStatusCode()));
        result.setSignalStrength(HzhrTypeUtil.integer2integer(in.getSignalStrength()));
        result.setCellVoltage(HzhrTypeUtil.float2float(in.getCellVoltage()));
        result.setCellId(HzhrTypeUtil.object2string(in.getCellId()));
        result.setAlarmCodes(HzhrTypeUtil.string2string(in.getAlarmCodes()));
        return result;
    }
    public List<CollectDataPostModel> extList2collectDataPostModelList(List<CollectDataEntityExt> in) {
        if (in == null) return null;
        List<CollectDataPostModel> result = new ArrayList<>();
        for (CollectDataEntityExt item : in) {
            result.add(ext2collectDataPostModel(item));
        }
        return result;
    }
    public CollectDataEntity concentrator_Meter_CollectDataModel2entity(Concentrator_Meter_CollectDataModel in) {
        //未转换字段: iotDeviceId workFlowRate extProp isValid updateTime pressure collectDeviceId staFlowRate cellId createTime disTotalFlow staTotalFlow temperature workTotalFlow alarmCodes state 
        if (in == null) return null;
        CollectDataEntity result = new CollectDataEntity();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setCurrentTm(HzhrTypeUtil.long2date(in.getCurrentTm()));
        result.setCurrentValue(HzhrTypeUtil.double2double(in.getCurrentValue()));
        result.setFreezingTime(HzhrTypeUtil.long2date(in.getFreezingTime()));
        result.setFreezingValue(HzhrTypeUtil.double2double(in.getFreezingValue()));
        result.setValveStatusCode(HzhrTypeUtil.string2string(in.getValveStatusCode()));
        result.setSignalStrength(HzhrTypeUtil.integer2integer(in.getSignalStrength()));
        result.setCellVoltage(HzhrTypeUtil.float2float(in.getCellVoltage()));
        return result;
    }
    public CollectDataEntity concentrator_Meter_CollectDataModel2entity(Concentrator_Meter_CollectDataModel in, CollectDataEntity ori) {
        //未转换字段: iotDeviceId workFlowRate extProp isValid updateTime pressure collectDeviceId staFlowRate cellId createTime disTotalFlow staTotalFlow temperature workTotalFlow alarmCodes state 
        if (in == null) return null;
        CollectDataEntity result = ori;

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setCurrentTm(HzhrTypeUtil.long2date(in.getCurrentTm()));
        result.setCurrentValue(HzhrTypeUtil.double2double(in.getCurrentValue()));
        result.setFreezingTime(HzhrTypeUtil.long2date(in.getFreezingTime()));
        result.setFreezingValue(HzhrTypeUtil.double2double(in.getFreezingValue()));
        result.setValveStatusCode(HzhrTypeUtil.string2string(in.getValveStatusCode()));
        result.setSignalStrength(HzhrTypeUtil.integer2integer(in.getSignalStrength()));
        result.setCellVoltage(HzhrTypeUtil.float2float(in.getCellVoltage()));
        return result;
    }
    public List<CollectDataEntity> concentrator_Meter_CollectDataModelList2entityList(List<Concentrator_Meter_CollectDataModel> in) {
        if (in == null) return null;
        List<CollectDataEntity> result = new ArrayList<>();
        for (Concentrator_Meter_CollectDataModel item : in) {
            result.add(concentrator_Meter_CollectDataModel2entity(item));
        }
        return result;
    }
    public Concentrator_Meter_CollectDataModel entity2concentrator_Meter_CollectDataModel(CollectDataEntity in) {
        //未转换字段: valveStatusDes 
        if (in == null) return null;
        Concentrator_Meter_CollectDataModel result = new Concentrator_Meter_CollectDataModel();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setCurrentTm(HzhrTypeUtil.date2long(in.getCurrentTm()));
        result.setCurrentValue(HzhrTypeUtil.double2double(in.getCurrentValue()));
        result.setFreezingTime(HzhrTypeUtil.date2long(in.getFreezingTime()));
        result.setFreezingValue(HzhrTypeUtil.double2double(in.getFreezingValue()));
        result.setValveStatusCode(HzhrTypeUtil.string2string(in.getValveStatusCode()));
        result.setSignalStrength(HzhrTypeUtil.integer2integer(in.getSignalStrength()));
        result.setCellVoltage(HzhrTypeUtil.float2float(in.getCellVoltage()));
        return result;
    }
    public List<Concentrator_Meter_CollectDataModel> entityList2concentrator_Meter_CollectDataModelList(List<CollectDataEntity> in) {
        if (in == null) return null;
        List<Concentrator_Meter_CollectDataModel> result = new ArrayList<>();
        for (CollectDataEntity item : in) {
            result.add(entity2concentrator_Meter_CollectDataModel(item));
        }
        return result;
    }
    public Concentrator_Meter_CollectDataModel ext2concentrator_Meter_CollectDataModel(CollectDataEntityExt in) {
        //未转换字段: valveStatusDes 
        if (in == null) return null;
        Concentrator_Meter_CollectDataModel result = new Concentrator_Meter_CollectDataModel();

        result.setId(HzhrTypeUtil.integer2integer(in.getId()));
        result.setCurrentTm(HzhrTypeUtil.date2long(in.getCurrentTm()));
        result.setCurrentValue(HzhrTypeUtil.double2double(in.getCurrentValue()));
        result.setFreezingTime(HzhrTypeUtil.date2long(in.getFreezingTime()));
        result.setFreezingValue(HzhrTypeUtil.double2double(in.getFreezingValue()));
        result.setValveStatusCode(HzhrTypeUtil.string2string(in.getValveStatusCode()));
        result.setSignalStrength(HzhrTypeUtil.integer2integer(in.getSignalStrength()));
        result.setCellVoltage(HzhrTypeUtil.float2float(in.getCellVoltage()));
        return result;
    }
    public List<Concentrator_Meter_CollectDataModel> extList2concentrator_Meter_CollectDataModelList(List<CollectDataEntityExt> in) {
        if (in == null) return null;
        List<Concentrator_Meter_CollectDataModel> result = new ArrayList<>();
        for (CollectDataEntityExt item : in) {
            result.add(ext2concentrator_Meter_CollectDataModel(item));
        }
        return result;
    }
    public Concentrator_Meter_CollectDataGetModel extList2concentrator_Meter_CollectDataGetModel(List<CollectDataEntityExt> extList, Integer total, Integer changeCount, Map<String, Object> query) {
        List<Concentrator_Meter_CollectDataModel> modelList = extList2concentrator_Meter_CollectDataModelList(extList);
        if (modelList == null) {
            Concentrator_Meter_CollectDataGetModel result = new Concentrator_Meter_CollectDataGetModel();
            result.setTotal(total);
            result.setChangeCount(changeCount);
            return result;
        }

         String _show = HzhrTypeUtil.object2string(query.get("_show"));
         Boolean _show_info = query.get("_show_info") != null ? Boolean.parseBoolean(query.get("_show_info").toString()) : false;

        if (!_show_info) {
            for (Concentrator_Meter_CollectDataModel model : modelList) {
                model.setCurrentTm(null);
                model.setCurrentValue(null);
                model.setFreezingTime(null);
                model.setFreezingValue(null);
                model.setValveStatusCode(null);
                model.setValveStatusDes(null);
                model.setSignalStrength(null);
                model.setCellVoltage(null);
            }
        }

        Concentrator_Meter_CollectDataGetModel result = new Concentrator_Meter_CollectDataGetModel();
        if ("one".equals(_show)) {
            if (modelList.size() > 0) {
                result.setModel(modelList.get(0));
            }
         }
        if ("list".equals(_show)) {
            result.setModelList(modelList);
        }
        result.setTotal(total);
        result.setChangeCount(changeCount);
        return result;
    }
    public Concentrator_Meter_CollectDataGetModel entity2concentrator_Meter_CollectDataGetModel(CollectDataEntity entity, Integer total, Integer changeCount, Map<String, Object> query) {
        List<CollectDataEntityExt> extList = new ArrayList<>();
        if (entity == null) return extList2concentrator_Meter_CollectDataGetModel(extList, total, changeCount, query);
        extList.add(HzhrJsonUtil.convertObjectType(entity, CollectDataEntityExt.class));
        return extList2concentrator_Meter_CollectDataGetModel(extList, total, changeCount, query);
     }
    public CollectDataCustomQueryModel collectDataService_query2queryModel(Map<String, Object> query) {
        CollectDataCustomQueryModel queryModel = new CollectDataCustomQueryModel();

        Integer _equal_id = HzhrTypeUtil.object2integer(query.get("_equal_id"));
        if (_equal_id != null) {
            queryModel.setEqual_id(_equal_id);
         }

        Integer _equal_collectDeviceId = HzhrTypeUtil.object2integer(query.get("_equal_collectDeviceId"));
        if (_equal_collectDeviceId != null) {
            queryModel.setEqual_collectDeviceId(_equal_collectDeviceId);
         }

        String _equal_collectDeviceCode = HzhrTypeUtil.object2string(query.get("_equal_collectDeviceCode"));
        if (_equal_collectDeviceCode != null) {
            queryModel.setEqual_collectDeviceExt_code(_equal_collectDeviceCode);
         }

        Date _equal_currentTm = HzhrTypeUtil.object2date(query.get("_equal_currentTm"));
        if (_equal_currentTm != null) {
            queryModel.setEqual_currentTm(_equal_currentTm);
         }

        Date _greaterthanorequal_currentTm = HzhrTypeUtil.object2date(query.get("_greaterthanorequal_currentTm"));
        if (_greaterthanorequal_currentTm != null) {
            queryModel.setGreaterthanorequal_currentTm(_greaterthanorequal_currentTm);
         }

        Date _greaterthan_currentTm = HzhrTypeUtil.object2date(query.get("_greaterthan_currentTm"));
        if (_greaterthan_currentTm != null) {
            queryModel.setGreaterthan_currentTm(_greaterthan_currentTm);
         }

        Date _lessthanorequal_currentTm = HzhrTypeUtil.object2date(query.get("_lessthanorequal_currentTm"));
        if (_lessthanorequal_currentTm != null) {
            queryModel.setLessthanorequal_currentTm(_lessthanorequal_currentTm);
         }

        Date _lessthan_currentTm = HzhrTypeUtil.object2date(query.get("_lessthan_currentTm"));
        if (_lessthan_currentTm != null) {
            queryModel.setLessthan_currentTm(_lessthan_currentTm);
         }

        String _orderBy_currentTm = HzhrTypeUtil.object2string(query.get("_orderBy_currentTm"));
        if (_orderBy_currentTm != null) {
            queryModel.setOrderBy_currentTm(_orderBy_currentTm);
         }

        Integer _equal_iotDeviceId = HzhrTypeUtil.object2integer(query.get("_equal_iotDeviceId"));
        if (_equal_iotDeviceId != null) {
            queryModel.setEqual_iotDeviceId(_equal_iotDeviceId);
         }

        Boolean _isnull_alarmCodes = HzhrTypeUtil.object2boolean(query.get("_isnull_alarmCodes"));
        if (_isnull_alarmCodes != null) {
            queryModel.setIsnull_alarmCodes(_isnull_alarmCodes);
         }

        Boolean _show_info = HzhrTypeUtil.object2boolean(query.get("_show_info"));
        if (_show_info != null && _show_info) {
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setExt_valveStatusExt(true);
            queryModel.setShow13(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
        }
        Boolean _show_ext = HzhrTypeUtil.object2boolean(query.get("_show_ext"));
        if (_show_ext != null && _show_ext) {
            queryModel.setShow(true);
        }
        Boolean _show_collectDevice = HzhrTypeUtil.object2boolean(query.get("_show_collectDevice"));
        if (_show_collectDevice != null && _show_collectDevice) {
            queryModel.setExt_collectDeviceExt(true);
            queryModel.setShow18(true);
        }

        Integer page = HzhrTypeUtil.object2integer(query.get("_page"));
        Integer count = HzhrTypeUtil.object2integer(query.get("_count"));
        queryModel.setPage(page, count);

        return queryModel;
    }
    public CollectDataCustomQueryModel concentrator_Meter_CollectDataService_query2queryModel(Map<String, Object> query) {
        CollectDataCustomQueryModel queryModel = new CollectDataCustomQueryModel();

        Integer _equal_id = HzhrTypeUtil.object2integer(query.get("_equal_id"));
        if (_equal_id != null) {
            queryModel.setEqual_id(_equal_id);
         }

        String _equal_valveStatusCode = HzhrTypeUtil.object2string(query.get("_equal_valveStatusCode"));
        if (_equal_valveStatusCode != null) {
            queryModel.setEqual_valveStatusCode(_equal_valveStatusCode);
         }

        Date _greaterthanorequal_createTime = HzhrTypeUtil.object2date(query.get("_greaterthanorequal_createTime"));
        if (_greaterthanorequal_createTime != null) {
            queryModel.setGreaterthanorequal_createTime(_greaterthanorequal_createTime);
         }

        Date _lessthan_createTime = HzhrTypeUtil.object2date(query.get("_lessthan_createTime"));
        if (_lessthan_createTime != null) {
            queryModel.setLessthan_createTime(_lessthan_createTime);
         }

        Boolean _show_info = HzhrTypeUtil.object2boolean(query.get("_show_info"));
        if (_show_info != null && _show_info) {
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
            queryModel.setExt_valveStatusExt(true);
            queryModel.setShow13(true);
            queryModel.setShow(true);
            queryModel.setShow(true);
        }

        Integer page = HzhrTypeUtil.object2integer(query.get("_page"));
        Integer count = HzhrTypeUtil.object2integer(query.get("_count"));
        queryModel.setPage(page, count);

        return queryModel;
    }

}

